package com.darwin.darwinUI.manager
{
	import com.greensock.easing.Back;
	import com.greensock.easing.Bounce;
	import com.greensock.easing.Circ;
	import com.greensock.easing.Cubic;
	import com.greensock.easing.Linear;
	import com.greensock.easing.Sine;

	/**
	 * 全局的管理器,包括鼠标管理,tips管理
	 * 
	 * UIManager是个单例集，其的的管理器实际上都是单例，但项目中可以通过register方法扩展某个管理器的功能<br/>
	 * 实现的机制是，通过一个私有变量来保存管理类的类对象，外部可以通过相关的register方法改变这个类，
	 * 外部则通过相关的get方法取得实例，get方法的内部对保存的变量进行处理，如果保存的是个类则将它实例化后保存并返回，
	 * 如果是个实例则直接返回
	 * @author Roland
	 */
	public class UIManager
	{
		public function UIManager()
		{
		}
		
		//////////////////////////////////////////////////////
		
		private static var _scenePanelManager:* = ScenePanelManager;
		
		public static function registerScenePanelManager(c:Class):void
		{
			_scenePanelManager = c;
		}
		
		public static function getScenePanelManager():ScenePanelManager
		{
			_scenePanelManager = getInstance(_scenePanelManager);
			return _scenePanelManager;
		}
		
		
		//////////////////////////////////////////////////////
		
		private static var _panelManager:* = PanelManager;
		
		public static function registerPanelManager(c:Class):void
		{
			_panelManager = c;
		}
		
		public static function getPanelManager():PanelManager
		{
			_panelManager = getInstance(_panelManager);
			return _panelManager;
		}
		
		
		
		//////////////////////////////////////////////////////
		
		private static var _mouseManager:* = MouseManager;
		
		public static function registerMouseManager(c:Class):void
		{
			_mouseManager = c;
		}
		
		public static function getMouseManager():MouseManager
		{
			_mouseManager = getInstance(_mouseManager);
			return _mouseManager;
		}
		
		
		//////////////////////////////////////////////////////////////////////////////
		
		private static var _dragManager:* = DragManager;
		
		public static function registerDragManager(c:Class):void
		{
			_dragManager = c;
		}
		
		public static function getDragManager():DragManager
		{
			_dragManager = getInstance(_dragManager);
			return _dragManager;
		}
		
		
		////////////////////////////////////////////////////////////////////////////////
		
		private static var _toolTipManager:* = ToolTipManager;
		
		public static function registerToolTipManager(c:Class):void
		{
			_toolTipManager = c;
		}
		public static function getToolTipManager():ToolTipManager
		{
			_toolTipManager = getInstance(_toolTipManager);
			return _toolTipManager;
		}
		
		
		
		////////////////////////////////////////////////////////////////////////////////////////////
		
		
		private static var _popUpManager:* = PopUpManager;
		
		public static function registerPopUpManager(c:Class):void
		{
			_popUpManager = c;
		}
		
		
		public static function getPopUpManager():PopUpManager
		{
			_popUpManager = getInstance(_popUpManager);
			return _popUpManager;
		}
		
		
		////////////////////////////////////////////////////////////////////////////////////////////////		
		
		private static var _languageManager:* = LanguageManager;
		
		
		/**
		 * 注册语言管理器
		 * @param c
		 */
		public static function registerLanguageManager(c:Class):void
		{
			_languageManager = c;
		}
		
		/**
		 * 语言管理器
		 * @return 
		 */
		public static function getLanguageManager():LanguageManager
		{
			_languageManager = getInstance(_languageManager);
			return _languageManager;
		}
		
		/////////////////////////////////////////////////////////////////////////////////////////////////////
		
		/**
		 * 
		 * 获得一个实例
		 */
		private static function getInstance(c:*):*
		{
			if(c == null) return null;
			if(c is Class) return new c();
			return c;
		}
		
		
	}
}